<?php
/**
 * Created by PhpStorm.
 * User: iqgmy
 * Date: 2020/10/23
 * Time: 2:02 PM
 */
namespace app\channel\model;
use think\facade\Cache;
use think\Db;
//*------------------------------------------------------ */
//-- 奖励记录
/*------------------------------------------------------ */
class BondModel extends RewardLogRunModel
{
    protected $table = 'channel_proxy_bond_log';
    public $pk = 'id';

    /*------------------------------------------------------ */
    //-- 获取订单奖励明细
    //-- $order_id int 订单ID
    /*------------------------------------------------------ */
    public function getOrderRewardLog($order_id)
    {
        $mkey = 'channel_order_reward_list_'.$order_id;
        $list = Cache::get($mkey);
        if (empty($list) == false){
            return $list;
        }
        $where[] = ['from_type','=','order'];
        $where[] = ['from_id','=',$order_id];
        return $this->where($where)->select()->toArray();
    }

}